package com.ruoyi.common.enums;

/**
 * 呼叫类型枚举
 * @Author qiqi
 * @Date 2022/9/5 9:46
 * @Version 1.0
 */
public enum CrmCdrStatusEnum {
    /**
     * 座席未接听
     */
    AGENT_NOT_ANSWERED(30L,"座席未接听"),
    /**
     * 座席未接听,未呼叫客户
     */
    AGENT_ANSWERED_NOT_CALL_CUSTOMER(31L,"座席接听，未呼叫客户"),
    /**
     * 座席接听,客户未接听
     */
    AGENT_ANSWERED_CUSTOMER_NOT_ANSWERED(32L,"座席接听，客户未接听"),
    /**
     * 双方接听
     */
    BOTH_SIDES_ANSWER(33L,"双方接听"),
    /**
     * 主叫外呼, 双方接听
     */
    CALLING_EXTERNAL_CALL(0L,"主叫外呼，双方接听");

    private final Long code;
    private final String message;

    CrmCdrStatusEnum(Long code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * 通过代码获取枚举项
     * @param code
     * @return
     */
    public static CrmCdrStatusEnum getByCode(Long code) {
        for (CrmCdrStatusEnum le : CrmCdrStatusEnum.values()) {
            if (le.getCode().equals(code)) {
                return le;
            }
        }

        return null;
    }

    public static CrmCdrStatusEnum getByDesc(String message) {
        for (CrmCdrStatusEnum le : CrmCdrStatusEnum.values()) {
            if (message.equals(le.getMessage())) {
                return le;
            }
        }
        return null;
    }

    public Long getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }}
